package com.hgvip.controller;

import com.hgvip.entity.City;
import com.hgvip.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by arnold.zhu on 6/13/2017.
 */
@RestController
@RequestMapping("/city")
public class Citys {

    @Autowired
    private CityService cityService;

    @RequestMapping(value = "/getCities", method = RequestMethod.GET)
    public List<City> getCities() {
        return cityService.getCities();
    }

    @RequestMapping(value = "/addCity", method = RequestMethod.POST)
    public Object addCity(@RequestBody City city) {
        return cityService.addCity(city);
    }

}
